package com.eva.databuilder.builders.cms;

import com.eva.cms.biz.article.CmsArticleBiz;
import com.eva.databuilder.builders.AbstractTemplateDataBuilder;
import com.eva.databuilder.bo.TemplateDataParameters;
import com.eva.service.cms.vo.CmsArticleDetailVO;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 构建文章详情数据
 */
@Component
public class ArticleDetailBuilder extends AbstractTemplateDataBuilder<CmsArticleDetailVO> {

    private static final String PARAMETER_ARTICLE_UID = "articleUid";

    private static final String PARAMETER_MODE = "mode";

    @Resource
    private CmsArticleBiz cmsArticleBiz;

    @Override
    public CmsArticleDetailVO build (TemplateDataParameters parameters) {
        return cmsArticleBiz.detail(
                parameters.getString(PARAMETER_ARTICLE_UID, null),
                parameters.getString(PARAMETER_MODE, ""));
    }
}
